﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Microsoft.DevDiv.Wpf.Samples.DrawVisualSample
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();

            UpdateStatusText();
        }

        private void Handle_ChangeContent_Clicked(object sender, EventArgs e)
        {
            if (this.transitionHost != null)
            {
                this.transitionHost.Child = GenerateContent();
            }

            UpdateStatusText();
        }

        private void Handle_ChangeMode_Clicked(object sender, EventArgs e)
        {
            if (this.transitionHost != null)
            {
                this.transitionHost.IsVectorTransitionEnabled = !this.transitionHost.IsVectorTransitionEnabled;
            }

            UpdateStatusText();
        }

        private void UpdateStatusText()
        {
            if (this.transitionModeText != null)
            {
                this.transitionModeText.Text = this.transitionHost.IsVectorTransitionEnabled ?
                    "Vector snapshot transitions are enabled"
                    : "Bitmap snapshot transitions are enabled";
            }
        }

        private static UIElement GenerateContent()
        {
            StringBuilder text = new StringBuilder();

            for (int i = 0; i < 10; i++)
            {
                text.Append(Guid.NewGuid());
                text.AppendLine(DateTime.Now.ToString());
            }

            return new TextBlock() { 
                Opacity = 0.5,
                Background = Brushes.Wheat,
                Text = text.ToString() 
            }
            ;
        }
    }
}
